package cc.jethro.jdxyq.activity;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * Activity管理工具
 * Created by jethro on 2017/5/12.
 */

public class ActivityCollector {

    public static List<Activity> activities = new ArrayList<>();

    public static void addActivity(Activity activity) {
        activities.add(activity);
    }

    public static void removeActivity(Activity activity) {
        activities.remove(activity);
    }

    /**
     * 获取栈顶的Activity
     * @return
     */
    public static Activity getTopActivity() {
        Activity activity = activities.get(activities.size() - 1);
        return activity;
    }
}
